package cn.tedu.boot05.mapper;

import cn.tedu.boot05.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {
    @Insert("insert into user values(null,#{username},#{password},#{nickname})")
    void insert(User user);
    //通过用户名查询到一个密码,通过用户对象封装查询到的密码
    //此时如果数据库的user表有重复数据会报错,因为多条数据无法装进一个User对象
    @Select("select password from user where username=#{username}")
    User selectByUsername(String username);

}